package jeecg.mongodb.db;

import java.io.File;
import java.io.IOException;

import jeecg.mongodb.system.DBFileSystem;
import jeecg.mongodb.system.DataBase;
import jeecg.mongodb.util.ParseXml;

public class DataBaseOpration extends Opration {
	
	public DataBase createDB(String dbName){
		String path=ParseXml.parseDBPath();
		File file=new File(path+"/"+dbName);
		if(!file.exists()){
			file.mkdir();
		}
		return new DataBase(dbName,path);
	}
	
	public String dropDB(String dbName){
		String path=ParseXml.parseDBPath();
		File file=new File(path+"/"+dbName);
		if(file.exists()){
			DBFileSystem.delAllFiles(file);
		}
		return "success";
	}
	//查看帮助方法
	@SuppressWarnings("unused")
	private String help(){
		return super.help("jeecg.mongodb.db.DataBaseOpration");
	}
	
}
